<?php
	class User_habit extends MY_controller{

		function __construct(){
			parent::__construct();
		}

		function index($limit = 0){
			$this->load->model('Habit_model');
			$result = $this->Habit_model->get_habit_list($limit,20);

			//分页设置
			$this->load->library('pagination');
			$page_config['base_url'] = '/user_habit/index/' ;
			$page_config['total_rows'] = $result['count'];
			$page_config['per_page'] = $this->offset;
			$page_config['uri_segment'] = 3;
			$this->pagination->initialize($page_config);
			$pagination = $this->pagination->create_links();

			$current_url = '/user_habit';

			$this->smarty->assign("action", '用户习惯列表');
			$this->smarty->assign("total_count", $result['count']);
			$this->smarty->assign("name", '');
			$this->smarty->assign("conditions", '');
			$this->smarty->assign("current_url", $current_url);
			$this->smarty->assign("list", $result['result']);
			$this->smarty->assign("pagination", $pagination);
			$this->smarty->display("habit/list.html");


		}

	}